import request from '@/utils/request'
import qs from 'qs'

// 获取所有语言
export function getLanguageList (pageNumber, pageSize) {
  return request({
    url: '/cms/language/list',
    method: 'get',
    params: {
      pageNumber,
      pageSize
    }
  })
}


// 添加语言
export function addLanguage (data) {
  return request({
    url: '/cms/language/save',
    method: 'post',
    data: qs.stringify(
      data
    )
  })
}

// 删除语言
export function deleteLanguages (ids) {
  return request({
    url: '/cms/language/delete',
    method: 'post',
    data: qs.stringify({
      ids
    }, {indices: false})
  })
}

// 编辑语言
export function updateLanguage (languageInfo) {
  return request({
    url: '/cms/language/update',
    method: 'post',
    data: qs.stringify({
      id: languageInfo.id,
      name: languageInfo.name,
    }, {indices: false})
  })
}


// 获取所有类别
export function selectLanguage () {
  return request({
    url: '/cms/language/select_item',
    method: 'get',
  })
}
